home *** CD-ROM | disk | FTP | other *** search
- /*--------------------------------------------------------------------------*/
- /* */
- /* */
- /* ------------ Bit-Bucket Software <no-Inc> */
- /* \ 10001101 / Writers and Distributors of */
- /* \ 011110 / No-Cost<no-tm> Software. */
- /* \ 1011 / */
- /* ------ */
- /* */
- /* Copyright (C) 1987, 1988, 1989 by Robert Hartman and Vincent Perriello */
- /* */
- /* */
- /* This module was originally written by Vince Perriello */
- /* */
- /* */
- /* BinkleyTerm Variable Initialization */
- /* */
- /* */
- /* For complete details of the licensing restrictions, please refer */
- /* to the License agreement, which is published in its entirety in */
- /* the MAKEFILE and BT.C, and also contained in the file LICENSE.210. */
- /* */
- /* USE OF THIS FILE IS SUBJECT TO THE RESTRICTIONS CONTAINED IN THE */
- /* BINKLEYTERM LICENSING AGREEMENT. IF YOU DO NOT FIND THE TEXT OF */
- /* THIS AGREEMENT IN ANY OF THE AFOREMENTIONED FILES, OR IF YOU DO */
- /* NOT HAVE THESE FILES, YOU SHOULD IMMEDIATELY CONTACT THE AUTHORS */
- /* AT THE ADDRESSES LISTED BELOW. IN NO EVENT SHOULD YOU PROCEED TO */
- /* USE THIS FILE WITHOUT HAVING ACCEPTED THE TERMS OF THE */
- /* BINKLEYTERM LICENSING AGREEMENT, OR SUCH OTHER AGREEMENT AS YOU */
- /* ARE ABLE TO REACH WITH THE AUTHORS. */
- /* */
- /* */
- /* The Authors can be reached at the following addresses: */
- /* */
- /* Robert C. Hartman Vincent E. Perriello */
- /* Spark Software VEP Software */
- /* 427-3 Amherst Street 111 Carroll Street */
- /* CS2032, Suite 232 Naugatuck, CT 06770 */
- /* Nashua, NH 03061 */
- /* */
- /* FidoNet 1:132/101 FidoNet 1:141/491 */
- /* Data (603) 888-8179 Data (203) 729-7569 */
- /* */
- /* Please feel free to contact us at any time to share your comments */
- /* about our software and/or licensing policies. */
- /* */
- /*--------------------------------------------------------------------------*/
-
- #include <stdio.h>
- #include <time.h>
- #include <string.h>
- #include <stdlib.h>
-
- #ifdef __TURBOC__
- #include <mem.h>
- #else
- #include <memory.h>
- #endif
-
- #include "com.h"
- #include "xfer.h"
- #include "zmodem.h"
- #include "keybd.h"
- #include "sbuf.h"
- #include "sched.h"
- #include "externs.h"
- #include "prototyp.h"
-
- static void compile_externs (void);
-
- /**
- ** b_initvars -- called before parse_config. Sets defaults that we want
- ** to have set FIRST.
- **/
-
-
- void b_initvars ()
- {
- int k;
-
- tzset ();
-
- DEFAULT.rq_OKFile = DEFAULT.rq_FILES = DEFAULT.rq_About = DEFAULT.rq_Template = DEFAULT.sc_Inbound = NULL;
- DEFAULT.rq_Limit = 30; /* This seems a good default */
-
- KNOWN.rq_OKFile = KNOWN.rq_FILES = KNOWN.rq_About = KNOWN.rq_Template = KNOWN.sc_Inbound = NULL;
- KNOWN.rq_Limit = -1;
-
- PROT.rq_OKFile = PROT.rq_FILES = PROT.rq_About = PROT.rq_Template = PROT.sc_Inbound = NULL;
- PROT.rq_Limit = -1;
-
- for (k = 0; k < 10; k++) /* Zero the phone scan list */
- {
- scan_list[k] = NULL;
- }
-
- for (k = 0; k < MAX_EXTERN; k++) /* And the external protocols*/
- {
- protocols[k] = NULL;
- }
-
- for (k = 1; k < ALIAS_CNT; k++) /* And the alias list */
- {
- alias[k].Zone = alias[k].Net = alias[k].Node = alias[k].Point = 0;
- }
-
- alias[0].Zone = 1; /* Make sure we have a zone */
- alias[0].Net = alias[0].Node = -1; /* Default Fidonet address */
- alias[0].Point = 0;
-
- b_init ();
-
- baud = 2;
- cur_baud = atoi (btypes[baud].str);
- command_line_un = 0;
- }
-
- /**
- ** b_defaultvars -- called after all parse_config passes complete.
- ** sets anything not handled by parse_config to default if we know it.
- **/
-
-
- void b_defaultvars ()
- {
-
- if (!fullscreen)
- do_screen_blank = 0;
-
- if (modem_init == NULL)
- modem_init = ctl_string ("|AT|");
- if (modem_busy == NULL)
- modem_busy = ctl_string ("|AT|");
-
-
- /* Set up "boss" and "point" addresses correctly if we can */
-
- if (!boss_net)
- {
- boss_net = alias[0].Net;
- boss_node = alias[0].Node;
- }
-
- if (alias[0].Point)
- {
- alias[0].Net = pvtnet;
- alias[0].Node = alias[0].Point;
- alias[0].Point = 0;
- }
-
- /* If we have the minimum information to do netmail, set the flag */
-
- if ((alias[0].Zone != 0)
- && (alias[0].Net != 0)
- && (system_name != NULL)
- && (sysop != NULL)
- && (hold_area != NULL)
- && (DEFAULT.sc_Inbound != NULL))
- net_params = 1;
-
- /* Make the "higher class" requests at least as well off as the
- "lowest class"... */
-
- if (KNOWN.rq_Limit == -1)
- KNOWN.rq_Limit = DEFAULT.rq_Limit;
- if (KNOWN.rq_FILES == NULL)
- KNOWN.rq_FILES = DEFAULT.rq_FILES;
- if (KNOWN.rq_OKFile == NULL)
- KNOWN.rq_OKFile = DEFAULT.rq_OKFile;
- if (KNOWN.rq_About == NULL)
- KNOWN.rq_About = DEFAULT.rq_About;
- if (KNOWN.rq_Template == NULL)
- KNOWN.rq_Template = DEFAULT.rq_Template;
- if (KNOWN.sc_Inbound == NULL)
- KNOWN.sc_Inbound = DEFAULT.sc_Inbound;
-
- if (PROT.rq_Limit == -1)
- PROT.rq_Limit = KNOWN.rq_Limit;
- if (PROT.rq_FILES == NULL)
- PROT.rq_FILES = KNOWN.rq_FILES;
- if (PROT.rq_OKFile == NULL)
- PROT.rq_OKFile = KNOWN.rq_OKFile;
- if (PROT.rq_About == NULL)
- PROT.rq_About = KNOWN.rq_About;
- if (PROT.rq_Template == NULL)
- PROT.rq_Template = KNOWN.rq_Template;
- if (PROT.sc_Inbound == NULL)
- PROT.sc_Inbound = KNOWN.sc_Inbound;
-
- if (extern_index)
- compile_externs (); /* generate extern_protocols */
- }
-
- static void compile_externs ()
- {
- register char *c;
- register i;
- char junk[100];
- int j, k, l;
- char *p;
- char x;
-
- i = l = 0; /* start at beginning */
- junk [0] = '\0';
-
- for (k = 0; protocols[k] != NULL; k++) /* Total no. of protos */
- {
- c = protocols[k]; /* Point at filename */
- if (!dexists (c)) /* Is it there? */
- {
- printf ("Can't find protocol module: %s\n", c);
- continue;
- }
- p = NULL;
- while (*c) /* Until end of string */
- {
- if ((*c == '\\') || (*c == ':')) /* Look for last path */
- p = c; /* Delimiter */
- c++;
- }
- if (strlen (p) < 3) /* If no name, */
- continue; /* No protocol... */
-
- p++; /* Point to the */
- x = toupper (*p); /* First character */
- if (strchr (junk, x) != NULL)
- {
- printf ("Duplicate protocol name: %s\n", c);
- continue;
- }
-
- protos[l].first_char = x; /* Makes lookup fast */
- protos[l++].entry = k; /* Now we know where */
-
- junk[i++] = x; /* Store first char */
- junk[i++] = ')'; /* Then a ')' */
- c = ++p; /* Point to 2nd char */
- for (j = 0; j < 9; j++) /* Up to 9 chars more */
- {
- if (*c != '.') /* If no comma yet, */
- {
- junk[i++] = tolower (*c); /* store the char and */
- ++c; /* bump the pointer */
- }
- else junk[i++] = ' '; /* otherwise pad it */
- }
- junk[i++] = ' '; /* And one more space */
- junk[i] = '\0'; /* Need for testing */
- }
-
- if (!i) /* If we got none, */
- return; /* Return now. */
-
- i += 2; /* Total for malloc */
- if ((extern_protocols = malloc (i)) == NULL) /* Allocate string */
- return; /* Return on failure */
- strcpy (extern_protocols, junk); /* Copy the string */
- return; /* Back to caller */
- }
-